﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Odin.Base.IO {
    public class Keybinding {
        public static Keys[] Mods = { Keys.ControlKey, Keys.ShiftKey, Keys.Menu };

        public Keys Key;
        public byte Modifiers = 0;
        public Action Pressed;
        public Action Held;
        public Action Released;
        public bool Reserved {
            get {
                return _Reserved;
            }
        }

        private bool _Reserved;

        public Keybinding(Keys key, byte mod, Action[] actions) {
            Key = key;
            Modifiers = mod;

            if (actions != null) {
                Pressed = actions[0];
                Held = actions[1];
                Released = actions[2];
            }
        }

        public Keybinding(Keys key, byte mod, Action[] actions, bool reserved) {
            Key = key;
            Modifiers = mod;
            _Reserved = reserved;

            if (actions != null) {
                Pressed = actions[0];
                Held = actions[1];
                Released = actions[2];
            }

            // LOG: Added Reserved Keybinding: Mods + key
#if (DEBUG)
            System.Console.WriteLine("LOG: Added Reserved Keybinding: " + Modifiers.ToString() + " " + key);
#endif
        }
    }
}
